// 答案转换
function changeAnswer(udaan){
	var daan = '';
	if(udaan == '1'){
		daan = 'A';
	}else if(udaan == '2'){
		daan = 'B';
	}else if(udaan == '3'){
		daan = 'C';
	}else if(udaan == '4'){
		daan = 'D';
	}else if(udaan == '5'){
		daan = 'E';	
	}else if(udaan == '6'){
		daan = 'F';	
	}else if(udaan == '7'){
		daan = 'G';	
	}else if(udaan == '8'){
		daan = 'H';	
	}else if(udaan == '9'){
		daan = 'I';	
	}else if(udaan == '10'){
		daan = 'J';
	}else if(udaan == '11'){
		daan = 'K';
	}else if(udaan == '12'){
		daan = 'L';
	}else if(udaan == '13'){
		daan = 'M';
	}else if(udaan == '14'){
		daan = 'N';
	}else if(udaan == '15'){
		daan = 'O';
	}else if(udaan == '16'){
		daan = 'P';
	}else if(udaan == '17'){
		daan = 'Q';
	}else if(udaan == '18'){
		daan = 'R';
	}else if(udaan == '19'){
		daan = 'S';
	}else if(udaan == '20'){
		daan = 'T';
	}else if(udaan == '21'){
		daan = 'U';
	}else if(udaan == '22'){
		daan = 'V';
	}else if(udaan == '23'){
		daan = 'W';
	}else if(udaan == '24'){
		daan = 'X';
	}else if(udaan == '25'){
		daan = 'Y';
	}else if(udaan == '26'){
		daan = 'Z';
	}

	return daan;
}

var num=1;
// 下一题
function nextQ(){
	var len = $(".qustionItem").size();
	var sLi=$(".examedSelectList").find(".item");
	var oLi=$(".qustionDiv").find(".qustionItem");
	oLi.eq(num).show().siblings(".qustionItem").hide();
	$(".selectDiv").find("#last").show();
    // 设置按钮状态
    setupStatusForButton();
    sLi.eq(num).css({'background':'#E3E3E3', 'color':'black', 'border':'1px solid #d9d9d9'});
    setupSingleBtn(num-1);
    // 标记题目
 	markQuestion();
	num++;
	$(".currentNumber").html(num);
	if(num == len){
	   $(".selectDiv").find("#next").hide()
	}

}

//上一题
function lastQ(){
    
	$(".selectDiv").find("#next").show();
	$(".qustionDiv").find(".qustionItem").eq(num-1).hide();
	var oLi=$(".qustionDiv").find(".qustionItem");
    num--;
	$(".qustionDiv").find(".qustionItem").eq(num-1).show();
	$(".currentNumber").html(num);
	var sLi=$(".examedSelectList").find(".item");
	// 设置按钮状态
	setupStatusForButton();
	sLi.eq(num-1).css({'background':'#E3E3E3', 'color':'black', 'border':'1px solid #d9d9d9'});
	setupSingleBtn(num);
	// 标记题目
 	markQuestion();
    
    if(num == 1){
	  $(".selectDiv").find("#last").hide();
	}
	
}
// 设置按钮状态
function setupStatusForButton()
{   
	var len = $(".qustionItem").size();
         
	for(var i = 0; i < len; i++){

		setupSingleBtn(i);

	}

}
// 设置单个按钮状态
function setupSingleBtn(number)
{
	var sLi=$(".examedSelectList").find(".item");
	//判断上一道题是否选择
	var mark = 0;
	var oDiv=$(".qustionItem").eq(number);
	if(oDiv.attr("flag") == "txt"){
		var oTxt=oDiv.find("textarea");
		var str=oTxt.val();
		if(str){
			mark = 1;
		}

	}else {
		var oSection=oDiv.find("section");
		var oLi=oSection.find("li");
		var len=oLi.size();
		
		for(var j=0; j<len; j++){
			if(oLi.eq(j).find("input").is(':checked') == true){
				mark = 1;
				break;
			}
		}

	}
	 
	if(mark == 0){
		sLi.eq(number).css({
			'background':'#fff',
			'color':'#000'

	    })
	    
	}else {
	
		sLi.eq(number).css({
			'background':'#CCFEFF',
			'color':'#58BFFD',
			'border':'1px solid #58BFFD'

	    });
        
        //未完成题目个数
	    if(count != 0){
	    	count --;
	    }
	    
	}
}

//通过选择列表选择题目
function selectClick(id)
{

	var len = $(".item").size();
	var selectId = parseFloat(id) - 1000;
	var index = $("#"+selectId+" span").html();
	//设置上一题下一题的num
	num = index;

	//显示相应题目
	$(".currentNumber").html(parseInt(index));
	
	if(parseInt(index) == 1){
		$(".selectDiv").find("#last").hide();

	}else{
		$(".selectDiv").find("#last").show();
	}
	if(parseInt(index) == len){
		$(".selectDiv").find("#next").hide();
	}else{
		$(".selectDiv").find("#next").show();
	}

	changeSelectNumStatus = 'hideSelectNum';
	//隐藏蒙版
	$(".myShadow").hide();
	//收起题号
	$(".operateDiv").css({
		"height":'49px',
		"overflow":'hidden'
	})
	$(".selectCardImg").attr({'src':'../image/card.png'});
	
	var oLi=$(".qustionDiv").find(".qustionItem");
    oLi.eq(parseInt(index)-1).show().siblings(".qustionItem").hide();
	var sLi=$(".examedSelectList").find(".item");
	// 设置按钮状态
	setupStatusForButton();
	sLi.eq(parseInt(index)-1).css({'background':'#E3E3E3', 'color':'black'})
	setupSingleBtn(num);
	// 标记题目
 	markQuestion();
   
}
// 显示考试数据
// var examCount = 0;
function displayData(data){
//alert (JSON.stringify(data));
	var fullscore = data.fullscore;
	var efen = data.efen;
	var examHtml = '';

	$(".sumScore").html(fullscore+'分');
	$(".passScore").html(efen+'分');
	if(data.shitiarr != null && data.shitiarr != 'null' && data.shitiarr != ''){
	var questionArr = data.shitiarr;
	var danArr = questionArr.dan;
	var duoArr = questionArr.duo;
	var panArr = questionArr.pan;
	var lunArr = questionArr.lunshu;
	var shituArr = questionArr.shitu;
	var anliArr = questionArr.anli;
	var paixuArr = questionArr.paixu;
	var danHtml = '';
	var duoHtml = '';
	var panHtml = '';
	var lunHtml = '';
	var shituHtml = '';
	var anliHtml = '';
	var paixuHtml = '';

	 // alert('6666+'+ JSON.stringify( danArr ) );

	if(danArr){//单选题
		for(var i = 0; i < danArr.length; i++){
            danHtml = danHtml + addDan(i, danArr[i]);
            if(resitType=='1'){
		    	examCount++;
				var qid = parseFloat(danArr[i].qid) - 1000;
				var lqid = qid.toString();
				$(".examedSelectList").append('<li class="item" id='+lqid+' onClick="selectClick('+danArr[i].qid+')"><span>'+examCount+'</span></li>');
			}	
		}
		examHtml = examHtml + danHtml;
		
		
		
	}

	if(duoArr){///多选题
		for(var i = 0; i < duoArr.length; i++){
		    duoHtml = duoHtml + addDuo(i, duoArr[i]);
		    if(resitType=='1'){
		    	examCount++;
				var qid = parseFloat(duoArr[i].qid) - 1000;
				var lqid = qid.toString();
				$(".examedSelectList").append('<li class="item" id='+lqid+' onClick="selectClick('+duoArr[i].qid+')"><span>'+examCount+'</span></li>');
			}	
		}
		examHtml = examHtml + duoHtml;
		

	}

	if(panArr){//判断题
		for(var i = 0; i < panArr.length; i++){
		    panHtml = panHtml + addPan(i, panArr[i]);
		     if(resitType=='1'){
		    	examCount++;
				var qid = parseFloat(panArr[i].qid) - 1000;
				var lqid = qid.toString();
				$(".examedSelectList").append('<li class="item" id='+lqid+' onClick="selectClick('+panArr[i].qid+')"><span>'+examCount+'</span></li>');
			}	
		}
		examHtml = examHtml + panHtml;

	}

	if(shituArr){//视图题
		for (var i = 0; i < shituArr.length; i++){
			shituHtml = shituHtml + addShitu(i, shituArr[i]);
			 if(resitType=='1'){
		    	examCount++;
				var qid = parseFloat(shituArr[i].qid) - 1000;
				var lqid = qid.toString();
				$(".examedSelectList").append('<li class="item" id='+lqid+' onClick="selectClick('+shituArr[i].qid+')"><span>'+examCount+'</span></li>');
			}
		}
		examHtml = examHtml + shituHtml;
	}

	if(paixuArr){//排序题
		for (var i = 0; i < paixuArr.length; i++){
			paixuHtml = paixuHtml + addPaixu(i, paixuArr[i]);
			 if(resitType=='1'){
		    	examCount++;
				var qid = parseFloat(paixuArr[i].qid) - 1000;
				var lqid = qid.toString();
				$(".examedSelectList").append('<li class="item" id='+lqid+' onClick="selectClick('+paixuArr[i].qid+')"><span>'+examCount+'</span></li>');
			}
		}
		examHtml = examHtml + paixuHtml;
	}

	if(lunArr){//论述题
		isLun = '1';
		for(var i = 0; i < lunArr.length; i++){
			lunFen = lunFen + parseFloat(lunArr[i].qfenshu);
		    lunHtml = lunHtml + addLun(i, lunArr[i]);
		    if(resitType=='1'){
		    	examCount++;
				var qid = parseFloat(lunArr[i].qid) - 1000;
				var lqid = qid.toString();
				$(".examedSelectList").append('<li class="item" id='+lqid+' onClick="selectClick('+lunArr[i].qid+')"><span>'+examCount+'</span></li>');
			}
		}
		examHtml = examHtml + lunHtml;

	}
	if(anliArr){//案例题
		for(var i = 0; i < anliArr.length; i++){
		    anliHtml = anliHtml + addAnli(i, anliArr[i]);
		    if(resitType=='1'){
		    	examCount++;
				var qid = parseFloat(anliArr[i].qid) - 1000;
				var lqid = qid.toString();
				$(".examedSelectList").append('<li class="item" id='+lqid+' onClick="selectClick('+anliArr[i].qid+')"><span>'+examCount+'</span></li>');
			}
		}
		examHtml = examHtml + anliHtml;

	}
	if(resitType=='2'){
		$(".qustionList").html(examHtml);
	}else{
		$(".qustionList").append(examHtml);
	}
	
}else {
	$(".noInternetDiv").hide();
	$(".noDataDiv").show();
	$(".qustionList").hide();
	$(".selectDiv").hide();
	$(".operateDiv").hide();
}

	
}

//对试题题目的处理
function parseQuestions(string){
	var questions = '';
    if(string.indexOf('style') > 0 && string.indexOf('img') <= 0){
    	var array = string.split(/[/>]/);
    	// alert(JSON.stringify(array));
    	for(var i = 0; i < array.length; i ++){
    		
    		if(array[i].indexOf('&nbsp;') == 0 && array[i].length > 10){
    			var str = array[i];
    			var strarr = str.split('<');
    			// alert(strarr[0]);
    			var arr = [];
    			arr.push('<p>');
    			arr.push(strarr[0]);
    			arr.push('</p>');
    			questions = arr.join('');
    			
    			break;
    		}
    	}
    }else {
    	questions = string;
    }
    return questions;

}

//对选项的处理
function parseOption(string){
	var option = '';
	if(string.indexOf('style') > 0 && string.indexOf('img') <= 0){
		// alert(string);
		var array = string.split(/[/]/);
		for(var i = 0; i < array.length; i++){
			var str = array[i];
			if(str.indexOf('<p>')>0){
				var strarr = str.split('>');
				var strp = strarr[2];
				var arrp = strp.split('<');
				var strq = arrp[0];
				var arr = [];
				arr.push('<p>');
				arr.push(strq);
				arr.push('</p>');

				option = arr.join('');
				// alert(option)

				break;
			}
		}

	}else {
		option = string;
	}
	return option;
}


// 添加单选试题
function addDan(num, data){
	
	var j = num+1;
    var selectHtml = '';
    var length = data.qxuanxiang.length;
    var xuans = data.qxuanxiang;
    var questions = parseQuestions(data.questions);
    var headHtml = '<li class="qustionItem option" style="display: none;" id='+data.qid+'>'+
					'<div class="queTitleDiv">'+
						'<img class="queIcon" src="../image/survey_title_icon.png" alt=""></img>'+
						'<p class="queTitle">单选题</p>'+
					'</div>'+
					'<div class="collectionDiv" onClick="collectionClick('+data.qid+')">'+
						'<button class="colIcon"><img src="../image/u33.png" alt=""></img></button>'+
						'<p class="collectionTitle">标记本题</p>'+
					'</div>'+
					'<div class="questionContentDiv">'+
				       '<section>'+
							'<form>'+
			                   '<p style="font-size:16px">'+j+'.('+data.qfenshu+'分) 请注意审题并做答<br/>'+questions+'</p>'+
								'<ul style="margin:0;padding:0; font-size:16px">';
								for (var m = length * num ; m < length * (num + 1); m++) {
									var index = m - length * num;
									var qxuan = xuans[index];
									var qcontent = parseOption(qxuan.xuanzhe);
									var qhtml = '<li><span class="inputDiv"><input id="r'+m+'" name="r'+j+'" type="radio" value="'+(index+1)+'" class="option-input radio"></span><label style="padding-left:30px" for="r'+m+'"><p>&nbsp;&nbsp;'+letters[index]+'.'+qcontent+'</p></label></li>';
									selectHtml = selectHtml + qhtml;
									
								}
    var nailHtml =		       '</ul>'+
							'</form>'+
				       '</section>'+
			        '</div>'+
				'</li>';
	
	return headHtml + selectHtml + nailHtml;
	
}

// 添加多选数据
function addDuo(num, data){
	    
    var html = '';
	var j = num + 1;
	var selectHtml = '';
    var xuans = data.qxuanxiang;
    var length = xuans.length;
    var questions = parseQuestions(data.questions);
    var headHtml = '<li style="display:none;" class="qustionItem option" id='+data.qid+'>'+
				    '<div class="queTitleDiv">'+
						'<img class="queIcon" src="../image/survey_title_icon.png" alt=""></img>'+
						'<p class="queTitle">多选题</p>'+
					'</div>'+
					'<div class="collectionDiv" onClick="collectionClick('+data.qid+')">'+
						'<button class="colIcon"><img src="../image/u33.png" alt=""></img></button>'+
						'<p class="collectionTitle">标记本题</p>'+
					'</div>'+
					'<div class="questionContentDiv">'+
				        '<section>'+
							'<form>'+
								'<p style="font-size:16px">'+j+'.('+data.qfenshu+'分) 请注意审题并做答<br/>'+questions+'</p>'+
								'<ul style="margin:0;padding:0;font-size:16px">';
								for (var m = length * num ; m < length * (num + 1); m++) {
									var index = m - length * num;
									var qxuan = xuans[index];
									var qcontent = parseOption(qxuan.xuanzhe);

		                        	var qhtml = '<li><span class="inputDiv"><input id="cb'+m+'" name="cb'+j+'" type="checkbox" value="'+(index+1)+'" class="option-input checkbox"></span><label style="padding-left:30px" for="cb'+m+'"><p><span>&nbsp;&nbsp;</span>'+letters[index]+'.'+qcontent+'</p></label></li>';
		                        	selectHtml = selectHtml + qhtml;
		                        }
													
	var nailHtml =				'</ul>'+
							'</form>'+
						'</section>'+
					'</div>'+
				'</li>';
	html = html + headHtml + selectHtml + nailHtml;


	return html;


}	

// 添加判断题
function addPan(num, data){
	var html = '';
	var j = num+1;
    var selectHtml = '';
    var length = data.qxuanxiang.length;
    var xuans = data.qxuanxiang;
    var questions = parseQuestions(data.questions);
    var headHtml = '<li style="display:none;" class="qustionItem option" id='+data.qid+'>'+
					    '<div class="queTitleDiv">'+
							'<img class="queIcon" src="../image/survey_title_icon.png" alt=""></img>'+
							'<p class="queTitle">判断题</p>'+
						'</div>'+
						'<div class="collectionDiv" onClick="collectionClick('+data.qid+')">'+
							'<button class="colIcon"><img src="../image/u33.png" alt=""></img></button>'+
							'<p class="collectionTitle">标记本题</p>'+
						'</div>'+
						'<div class="questionContentDiv">'+
					        '<section>'+
								'<form>'+
									'<p style="font-size:16px">'+j+'.('+data.qfenshu+'分) 请注意审题并做答<br/>'+questions+'</p>'+
									'<ul style="margin:0;padding:0;font-size:16px">';
									for (var m = length * num ; m < length * (num + 1); m++) {
										var index = m - length * num;
										var qxuan = xuans[index];
										var qcontent = qxuan.xuanzhe;
										if(qcontent == 'A'){
											qcontent = 'A. 对';
										}else {
											qcontent = 'B. 错';
										}
										var qhtml = '<li><span class="inputDiv"><input id="p'+m+'" name="p'+j+'" type="radio" value="'+(index+1)+'" class="option-input radio"></span><label style="padding-left:30px" for="p'+m+'">&nbsp;'+qcontent+'</label></li>';
										selectHtml = selectHtml + qhtml;

									}
	var nailHtml =				    '</ul>'+
								'</form>'+
							'</section>'+
						'</div>'+
					'</li>';
	html = html + headHtml + selectHtml + nailHtml;

	return html;


}

//添加排序试题
function addPaixu(num, data){
	var j = num+1;
    var selectHtml = '';
    var length = data.qxuanxiang.length;
    var xuans = data.qxuanxiang;
    var questions = parseQuestions(data.questions);
    var headHtml = '<li class="qustionItem option" style="display: none;" id='+data.qid+'>'+
					'<div class="queTitleDiv">'+
						'<img class="queIcon" src="../image/survey_title_icon.png" alt=""></img>'+
						'<p class="queTitle">排序题</p>'+
					'</div>'+
					'<div class="collectionDiv" onClick="collectionClick('+data.qid+')">'+
						'<button class="colIcon"><img src="../image/u33.png" alt=""></img></button>'+
						'<p class="collectionTitle">标记本题</p>'+
					'</div>'+
					'<div class="questionContentDiv">'+
				       '<section>'+
							'<form>'+
			                   '<p style="font-size:16px">'+j+'.('+data.qfenshu+'分) 请注意审题并做答<br/>'+questions+'</p>'+
								'<ul style="margin:0;padding:0; font-size:16px">';
								for (var m = length * num ; m < length * (num + 1); m++) {
									var index = m - length * num;
									var qxuan = xuans[index];
									var qcontent = parseOption(qxuan.xuanzhe);
									var qhtml = '<li><span class="inputDiv"><input id="px'+m+'" name="px'+j+'" type="radio" value="'+(index+1)+'" class="option-input radio"></span><label style="padding-left:30px" for="px'+m+'"><p>&nbsp;&nbsp;'+qcontent+'</p></label></li>';
									selectHtml = selectHtml + qhtml;
									
								}
    var nailHtml =		       '</ul>'+
							'</form>'+
				       '</section>'+
			        '</div>'+
				'</li>';
	
	return headHtml + selectHtml + nailHtml;
}

// 添加论述题
function addLun(num, data){
	var html = '';
	var j = num+1;
    var headHtml = '<li style="display:none;" class="qustionItem option" id='+data.qid+' flag="txt">'+
					    '<div class="queTitleDiv">'+
							'<img class="queIcon" src="../image/survey_title_icon.png" alt=""></img>'+
							'<p class="queTitle">论述题</p>'+
						'</div>'+
						'<div class="collectionDiv" onClick="collectionClick('+data.qid+')">'+
							'<button class="colIcon"><img src="../image/u33.png" alt=""></img></button>'+
							'<p class="collectionTitle">标记本题</p>'+
						'</div>'+
						'<div class="questionContentDiv">'+
					        '<section>'+
								'<form>'+
									'<p style="font-size:16px">'+j+'.('+data.qfenshu+'分) 请注意审题并做答<br/>'+data.questions+'</p>'+
									'<textarea rows="10" style="padding-right:10px; width:90%">'+
				                    '</textarea>'+
								'</form>'+
						    '</section>'+
					    '</div>'+
				       '</li>';
	html = html + headHtml;

	return html;


}

//添加案例题
function addAnli(num, data){
	var html = '';
	var j = num+1;
    var headHtml = '<li style="display:none;" class="qustionItem option" id='+data.qid+' flag="txt">'+
					    '<div class="queTitleDiv">'+
							'<img class="queIcon" src="../image/survey_title_icon.png" alt=""></img>'+
							'<p class="queTitle">案例题</p>'+
						'</div>'+
						'<div class="collectionDiv" onClick="collectionClick('+data.qid+')">'+
							'<button class="colIcon"><img src="../image/u33.png" alt=""></img></button>'+
							'<p class="collectionTitle">标记本题</p>'+
						'</div>'+
						'<div class="questionContentDiv">'+
					        '<section>'+
								'<form>'+
									'<p style="font-size:16px">'+j+'.('+data.qfenshu+'分) 请注意审题并做答<br/>'+data.questions+'</p>'+
									'<textarea rows="10" style="padding-right:10px; width:90%">'+
				                    '</textarea>'+
								'</form>'+
						    '</section>'+
					    '</div>'+
				       '</li>';
	html = html + headHtml;

	return html;


}


//添加识图题
function addShitu(num, data){
	// alert(JSON.stringify(data));
	var j = num+1;
    var selectHtml = '';
    var length = data.qxuanxiang.length;
    var xuans = data.qxuanxiang;
    // var qfenshu = '';
    // var questions = '';
    // if(api.pageParam.types == '2'){
    // 	qfenshu = data.score;
    // 	questions = data.question;

    // }
    var headHtml = '<li class="qustionItem option" style="display: none;" id='+data.qid+'>'+
					'<div class="queTitleDiv">'+
						'<img class="queIcon" src="../image/survey_title_icon.png" alt=""></img>'+
						'<p class="queTitle">识图题</p>'+
					'</div>'+
					'<div class="collectionDiv" onClick="collectionClick('+data.qid+')">'+
						'<button class="colIcon"><img src="../image/u33.png" alt=""></img></button>'+
						'<p class="collectionTitle">标记本题</p>'+
					'</div>'+
					'<div class="questionContentDiv">'+
				       '<section>'+
							'<form>'+
			                   '<p style="font-size:16px">'+j+'.('+data.qfenshu+'分) 请注意审题并做答<br/>'+data.questions+'</p>'+
								'<ul style="margin:0;padding:0; font-size:16px">';
								for (var m = length * num ; m < length * (num + 1); m++) {
									var index = m - length * num;
									var qxuan = xuans[index];
									var qcontent = qxuan.xuanzhe;
		                        	var qhtml = '<li><span class="inputDiv"><input id="st'+m+'" name="st'+j+'" type="checkbox" value="'+(index+1)+'" class="option-input checkbox"></span><label style="padding-left:30px" for="st'+m+'"><p><span>&nbsp;&nbsp;</span>'+qcontent+'</p></label></li>';
		                        	selectHtml = selectHtml + qhtml;
		                        }
    var nailHtml =		       '</ul>'+
							'</form>'+
				       '</section>'+
			        '</div>'+
				'</li>';
	
	return headHtml + selectHtml + nailHtml;

}
//倒计时
function countDown(){
	var minute = parseFloat($(" #minute").html()) * 60;
	 
	var second = parseFloat($(" #second").html());
	var time = minute + second;
//alert(minute+"=="+second);
	time--;
	var eMinute = 0;
	var eSecond = 0;

	if(time==0){
		// $(".examTime #minute").html('00');
		$(".examTime #second").html('00');
		api.toast({
           msg : '考试时间到！系统将为您自动交卷！',
           location : 'bottom',
           duration : 800,
        });
		saveAnswer();
		return;
        

	}else if (time > 0){
		if(time > 3600){
			eMinute = Math.floor(time/60);
		}else {
			eMinute = Math.floor(time/60%60);
		}
		eSecond = Math.floor(time%60);
		$(" #minute").html(eMinute);
		$(" #second").html(eSecond);
		if(eMinute < 10){
			$(".examTime #minute").html('0'+eMinute);
		}
		if(eSecond < 10){
			$(".examTime #second").html('0'+eSecond);
		}


	}
	if(istijiao==0){
	setTimeout('countDown()', 1000);
	}

	

}

//标记
function collectionClick(id){
    
	var oDiv = $("#"+id).find(".collectionDiv");
	oDiv.find("img").attr("src","../image/u33.png").parent().next().html("已标记");
	var qid = parseFloat(id)-1000;
	var lqid = qid.toString();
	
	$("#"+lqid).css({
		// 改变背景图片
		'background':'url("../image/mark.png")no-repeat'

	});

}
//随机数---假数据
function randomNumber(n){
    return Math.floor(Math.random()*n+1);
        
}

//将数组转化成字符串
function arrToString(arr){
	return arr.join(",");

}

//将字符串转化为数组
function stringToArr(string){
	return string.split(",");

}